<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div>:nth-child(-n+3):not(:nth-child(2)){
            color: red;
        }
    </style>
</head>
<body>
    <div>
        <p>p标签1</p>
        <p>p标签2</p>
        <p>p标签3</p>
        <p>p标签4</p>
        <p>p标签5</p>
    </div>
</body>
</html>